/*
*
* */
function quickSort(arr){
    let len = arr.length;
    if (len <= 1){
        return arr;
    }
    let mid = Math.floor(len/2);
    let mid_data = arr.splice(mid,1)[0];
    let left = [];
    let right = [];
    let index = 0;
    while (index < len - 1){
        if (mid_data <= arr[index]){
            right.push(arr[index++])
        }else{
            left.push(arr[index++])
        }
    }
    return [...quickSort(left),mid_data,...quickSort(right)]
}

let arr = quickSort([1,23,23,43,54,65,645,34,123,34,65,76]);
console.log(arr);